/**
 * Sorted Index Finder
 */

const getIndexToIns = (arr, num) => {
  arr.sort((a, b) => a - b);
  const index = arr.findIndex(item => item >= num);
  if (index < 0) return arr.length;
  return index;
}

console.log(getIndexToIns([1, 2, 3, 4], 1.5))